/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sv.gob.mh.dgii.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Hacienda
 */
@Entity
@Table(name = "DE_TERCERO", schema = "DECLARACIONES")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "DeTercero.findAll", query = "SELECT d FROM DeTercero d")})
public class DeTercero implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID_TERCERO")
    private Long idTercero;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 14)
    @Column(name = "NIT_TERCERO")
    private String nitTercero;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 14)
    @Column(name = "NIT_TITULAR")
    private String nitTitular;
    @Basic(optional = false)
    @NotNull
    @Column(name = "B_ACTIVO")
    private short bActivo;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "D_TERCEROS")
    private String dTerceros;
    @Basic(optional = false)
    @NotNull
    @Column(name = "FH_INICIO")
    @Temporal(TemporalType.DATE)
    private Date fhInicio;
    @Column(name = "FH_FIN")
    @Temporal(TemporalType.DATE)
    private Date fhFin;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idTercero")
    private List<DeTerceroAutDet> deTerceroAutDetList;

    public DeTercero() {
    }

    public DeTercero(Long idTercero) {
        this.idTercero = idTercero;
    }

    public DeTercero(Long idTercero, String nitTercero, String nitTitular, short bActivo, String dTerceros, Date fhInicio) {
        this.idTercero = idTercero;
        this.nitTercero = nitTercero;
        this.nitTitular = nitTitular;
        this.bActivo = bActivo;
        this.dTerceros = dTerceros;
        this.fhInicio = fhInicio;
    }

    public Long getIdTercero() {
        return idTercero;
    }

    public void setIdTercero(Long idTercero) {
        this.idTercero = idTercero;
    }

    public String getNitTercero() {
        return nitTercero;
    }

    public void setNitTercero(String nitTercero) {
        this.nitTercero = nitTercero;
    }

    public String getNitTitular() {
        return nitTitular;
    }

    public void setNitTitular(String nitTitular) {
        this.nitTitular = nitTitular;
    }

    public short getBActivo() {
        return bActivo;
    }

    public void setBActivo(short bActivo) {
        this.bActivo = bActivo;
    }

    public String getDTerceros() {
        return dTerceros;
    }

    public void setDTerceros(String dTerceros) {
        this.dTerceros = dTerceros;
    }

    public Date getFhInicio() {
        return fhInicio;
    }

    public void setFhInicio(Date fhInicio) {
        this.fhInicio = fhInicio;
    }

    public Date getFhFin() {
        return fhFin;
    }

    public void setFhFin(Date fhFin) {
        this.fhFin = fhFin;
    }

    @XmlTransient
    public List<DeTerceroAutDet> getDeTerceroAutDetList() {
        return deTerceroAutDetList;
    }

    public void setDeTerceroAutDetList(List<DeTerceroAutDet> deTerceroAutDetList) {
        this.deTerceroAutDetList = deTerceroAutDetList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTercero != null ? idTercero.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DeTercero)) {
            return false;
        }
        DeTercero other = (DeTercero) object;
        if ((this.idTercero == null && other.idTercero != null) || (this.idTercero != null && !this.idTercero.equals(other.idTercero))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "sv.gob.mh.dgii.model.DeTercero[ idTercero=" + idTercero + " ]";
    }
    
}
